package com.yc.Testjvm.classload.simple;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Test {
	
	public void m(String path) {
		InputStream is = null;
		try {
			File f = new File(path);
			int len = Long.valueOf(f.length()).intValue();
			if (len <= 0) {
				JavaClassExecuter.println("class文件为空");
				return;
			}
			is = new FileInputStream(f);
			byte[] b = new byte[len]; 
			is.read(b);
			JavaClassExecuter.execute(b);
		} catch (Exception e) {
			JavaClassExecuter.println(e);
			e.printStackTrace();
			if (is != null) {
				try {
					is.close();
				} catch (IOException e1) {
					JavaClassExecuter.println(e1);
				}
			}
		}
		
	}

	public static void main(String[] args) {
		
		Test t = new Test();
		String path = "G:\\git-my\\jdemo\\target\\classes\\com\\yc\\testPro\\TestStr.class";
		String[] param = new String[] {null};
		t.m(path);
		System.out.println(JavaClassExecuter.getPrint());
	}

}
